package ar.edu.itba.jMEBowling;

import com.jme.input.KeyInput;
import com.jme.input.action.InputActionEvent;
import com.jme.input.action.InputActionInterface;
import com.jme.renderer.Camera;
import com.jme.system.DisplaySystem;

public class CameraHandler implements InputActionInterface {

	private float cameraStep = 0.5f;

	@Override
	public void performAction(InputActionEvent evt) {
		if (KeyInput.get().isKeyDown(KeyInput.KEY_U)) {
			Camera cam = DisplaySystem.getDisplaySystem().getRenderer()
					.getCamera();
			cam.setLocation(cam.getLocation().add(0, 0, -cameraStep));
		}
		if (KeyInput.get().isKeyDown(KeyInput.KEY_J)) {
			Camera cam = DisplaySystem.getDisplaySystem().getRenderer()
					.getCamera();
			cam.setLocation(cam.getLocation().add(0, 0, cameraStep));
		}
		if (KeyInput.get().isKeyDown(KeyInput.KEY_H)) {
			Camera cam = DisplaySystem.getDisplaySystem().getRenderer()
					.getCamera();
			cam.setLocation(cam.getLocation().add(-cameraStep, 0, 0));
		}
		if (KeyInput.get().isKeyDown(KeyInput.KEY_K)) {
			Camera cam = DisplaySystem.getDisplaySystem().getRenderer()
					.getCamera();
			cam.setLocation(cam.getLocation().add(cameraStep, 0, 0));
		}

	}

}
